package com.gzsxy.sso.core.api.v1.config;

import com.gzsxy.sso.common.dto.response.DefaultResponse;
import com.gzsxy.sso.common.dto.response.MenuRsp;
import com.gzsxy.sso.common.result.R;
import com.gzsxy.sso.core.entity.vo.MenuQueryVo;
import com.gzsxy.sso.core.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 菜单对外相关接口
 * @date 2021/12/29 11:15
 */
@Api(tags = "api_v1_菜单相关接口")
@CrossOrigin  //解决跨域
@RestController
@RequestMapping("/api/v1/config/menu")
public class MenuApi {

    @Autowired
    private MenuService menuService;


    @ApiOperation("获取当前登录用户的菜单权限")
    @GetMapping("getUserMenu")
    public DefaultResponse getUserMenu(MenuQueryVo menuQueryVo){
        List<MenuRsp> menuRspList =  menuService.getUserMenu(menuQueryVo);
        return DefaultResponse.ok(menuRspList);
    }
}
